<template>
  <div class="container" ref="newSite">
    <div class="newSite">
      <div class="liubai"></div>
      <div class="newSite-header">
        <span class="back" @click="back"></span>
        <span class="header">新增地址</span>
      </div>
      <div class="newSite-center">
        <input class="new" type="text" placeholder="姓名">
        <input class="new" type="text" placeholder="手机号码">
        <input class="new" @click="newisShow" type="text" placeholder="省份、城市、区县">
        <input class="new" type="text" placeholder="详细地址，如街道、楼盘号等">
      </div>
      <div class="center">
        <span class="circle"></span>
        <span class="default">设为默认地址</span>
      </div>
      <div class="newSite-sole">
        <span  @click="top(val.to)" :to="val.to" class="newSite-click" v-for="(val, key) in news" :key="key">{{val.title}}</span>
      </div>
      <div class="sole" v-if="sole"></div>
    </div>
  </div>
</template>

<script>
import BScroll from 'better-scroll'
export default {
  name: 'newSite',
  data () {
    return {
      news: [
        {title: '取消', to: '/site'},
        {title: '保存', to: '/site'}
      ],
      sole: false
    }
  },
  methods: {
    back () {
      this.$router.push({path: '/site'})
    },
    newisShow () {
      this.sole = true
    },
    top (path) {
      this.$router.push({path: path})
    }
  },
  mounted () {
    this.$nextTick(() => {
      let newSite = this.$refs.newSite
      let scroll = new BScroll(newSite, {
        click: true,
        scrollY: true,
        bounce: false
      })
      return scroll
    })
  }
}
</script>

<style scoped lang="scss">
  .container {
    width: 100vw;
    height: 100vh;
    .newSite{
      width: 100vw;
      height: 100vh;
      .liubai{
        height: 60px;
        background: #fff;
      }
      .newSite-header{
        height: 130px;
        background: #fff;
        display: flex;
        justify-content: center;
        position: relative;
        border-bottom: solid 4px #dcdcdc;
        .back{
          width: 50px;
          height: 50px;
          border: solid 1px;
          position: absolute;
          left: 60px;
          top: 5px;
          transform: rotate(45deg);
          border-top: none;
          border-right: none;
        }
        .header{
          font-size: 50px;
        }
      }
      .newSite-center{
        background: #fff;
        padding-left: 55px;
        border-bottom: solid 1px #dcdcdc;
        height: 730px;
        .new{
          width: 100vw;
          line-height: 180px;
          border: none;
          border-bottom: solid 1px #dcdcdc;
          font-size: 42px;
        }
        .new:nth-child(4){
          border-bottom: none;
        }
        .new::placeholder{
          text-indent: 20px;
          color: #999;
        }
      }
      .center{
        line-height: 155px;
        font-size: 42px;
        display: flex;
        justify-content: center;
        align-items: center;
        background: #fafafa;
        border-bottom: solid 1px #dcdcdc;
        .circle{
          width: 55px;
          height: 55px;
          border: solid 1px #d2d2d2;
          border-radius: 50%;
          margin-right: 30px;
        }
        .default{
          font-size: 42px;
        }
      }
      .newSite-sole{
        line-height: 160px;
        background: #ec6b58;
        position: fixed;
        bottom: 0;
        display: flex;
        font-size: 50px;
        .newSite-click:nth-child(1){
          background: #fff;
          color: #000;
        }
        .newSite-click{
          width: 50vw;
          text-align: center;
          color: #fff;
        }
      }
      .sole{
        width: 100vw;
        height: 1000px;
        background: #fff;
        position: absolute;
        bottom: 0;
      }
    }
  }
</style>
